//
//  UserModel.m
//  HuaShun
//
//  Created by lxj on 16/8/15.
//  Copyright © 2016年 Phenix. All rights reserved.
//

#import "UserModel.h"

@implementation UserModel

#pragma mark - 单例对象调用方法

static UserModel  *_instance;

+ (UserModel*)shareModel
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        if (_instance == nil) {
            _instance = [[self alloc] init];
            _instance.user = nil;
            _instance.token = nil;
        }
    });
    return _instance;
}
+(void)clearModel{
    if (_instance.user) {
        _instance.user = nil;
        _instance.token = nil;
    }
}
//内部调用这个
+ (instancetype)allocWithZone:(struct _NSZone *)zone{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _instance = [super allocWithZone:zone];
        _instance.user = nil;
    });
    return _instance;
}

- (id)copyWithZone:(NSZone *)zone{
    return _instance;
}
- (id)mutableCopyWithZone:(NSZone *)zone {
    return _instance;
}

@end
